package es.app.services;

import java.util.List;

import es.app.beans.Player;
import es.app.daos.PlayerDAOImpl;
import es.app.services.interfaces.ServicioPlayers;

public class ServicioPlayersImpl extends ServicioGenerico<Player, Integer> implements ServicioPlayers<Player, Integer>{

	private PlayerDAOImpl daoPlayer = ((PlayerDAOImpl)dao);
	
	public void actualizarBien() throws Exception {
		List<Player> l = daoPlayer.findAll();
		for(Player p : l){
			p.setEdad(p.getEdad()+100);
			daoPlayer.update(p);
		}
	}

	public void actualizarMal() throws Exception {
		List<Player> l = daoPlayer.findAll();
		
		for(Player p : l){
			p.setEdad(p.getEdad()+100);
			daoPlayer.update(p);
		}
		throw new Exception();
		
	}

	public PlayerDAOImpl getDaoPlayer() {
		return daoPlayer;
	}

	public void setDaoPlayer(PlayerDAOImpl daoPlayer) {
		this.daoPlayer = daoPlayer;
	}
}
